package com.hue.springbooteasyexcel.listener;

import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.event.AnalysisEventListener;
import com.hue.springbooteasyexcel.domain.TbUser;
import com.hue.springbooteasyexcel.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @author 姚凤桥
 */
@Component
public class ExcelListener extends AnalysisEventListener<TbUser> {
    @Autowired
    private UserService userService;

    @Override
    public void invoke(TbUser tbUser, AnalysisContext analysisContext) {
        userService.add(tbUser);
    }

    @Override
    public void doAfterAllAnalysed(AnalysisContext analysisContext) {

    }
}
